﻿<UserControl x:Class="EmployeeTracker.View.EmployeeWorkspaceView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:v="clr-namespace:EmployeeTracker.View"
             xmlns:vm="clr-namespace:EmployeeTracker.ViewModel"
             mc:Ignorable="d" 
             d:DesignHeight="300" 
             d:DesignWidth="600">
    
    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="*" />
            <ColumnDefinition Width="Auto" />
        </Grid.ColumnDefinitions>

        <HeaderedContentControl Style="{StaticResource SubDisplayArea}" Grid.Column="0">
            <HeaderedContentControl.Header>
                Employees
            </HeaderedContentControl.Header>
            <ScrollViewer>
                <HeaderedContentControl>
                    <HeaderedContentControl.Header>
                        <StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
                            <TextBlock Margin="2">
                            <Hyperlink Command="{Binding Path=AddEmployeeCommand}">Add Employee</Hyperlink>
                            | <Hyperlink Command="{Binding Path=DeleteEmployeeCommand}">Delete Employee</Hyperlink>
                            </TextBlock>
                        </StackPanel>
                    </HeaderedContentControl.Header>

                    <DataGrid SelectedItem="{Binding Path=CurrentEmployee, Mode=TwoWay}" ItemsSource="{Binding Path=AllEmployees}" AutoGenerateColumns="False" >
                        <DataGrid.Columns>
                            <DataGridTextColumn Header="Last Name" Binding="{Binding Path=LastName}" />
                            <DataGridTextColumn Header="First Name" Binding="{Binding Path=FirstName}" />
                            <DataGridTextColumn Header="Position" Binding="{Binding Path=Position}" />
                        </DataGrid.Columns>
                    </DataGrid>
                </HeaderedContentControl>
            </ScrollViewer>
        </HeaderedContentControl>

        <HeaderedContentControl Style="{StaticResource SubDisplayArea}" Margin="10,0,0,0" Grid.Column="1" >
            <HeaderedContentControl.Header>
                Properties
            </HeaderedContentControl.Header>
            <ScrollViewer>
                <StackPanel>
                    <Border Style="{StaticResource DetailBorder}"  Margin="5">
                        <ContentControl HorizontalAlignment="Right" Content="{Binding Path=CurrentEmployee}">
                            <ContentControl.Resources>
                                <DataTemplate DataType="{x:Type vm:EmployeeViewModel}">
                                    <v:EmployeeDetailView />
                                </DataTemplate>
                            </ContentControl.Resources>
                        </ContentControl>
                    </Border>

                    <Border Style="{StaticResource DetailBorder}" Margin="5,0,5,5">
                        <ContentControl Content="{Binding Path=CurrentEmployee}" >
                            <ContentControl.Resources>
                                <DataTemplate DataType="{x:Type vm:EmployeeViewModel}">
                                    <v:EmployeeContactsDetailView />
                                </DataTemplate>
                            </ContentControl.Resources>
                        </ContentControl>
                    </Border>
                </StackPanel>
            </ScrollViewer>
        </HeaderedContentControl>
    </Grid>
</UserControl>
